CC=g++
CFLAGS=-O2 -Wno-write-strings

BIN=../../bin/
ULIB_DIR=/home/swlee/.lib/ulib_/
#ULIB_DIR=/Users/windnc/.lib/ulib_/

ULIB_INC=-I${ULIB_DIR}include
ULIB_OBJ=${ULIB_DIR}lib/ulib.a
OBJ=../giza.o ../tree.o ../copycat.o ../rule.o ../util.o

all: ${OBJ}
	mkdir -p ${BIN}
	${CC} ${CFLAGS} parse-conv.cpp -o ${BIN}parse-conv ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../

a:
	${CC} ${CFLAGS} parse2pos.cpp -o ${BIN}parse2pos ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} strippos.cpp -o ${BIN}strippos ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} parse-lex-recover.cpp -o ${BIN}parse-lex-recover ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} best-rule-filter.cpp -o ${BIN}best-rule-filter ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} avgst.cpp -o ${BIN}avgst ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} tratio.cpp -o ${BIN}tratio ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} parse-stat.cpp -o ${BIN}parse-stat ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} strippos.cpp -o ${BIN}strippos ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} rule-stat.cpp -o ${BIN}rule-stat ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} delwhite.cpp -o ${BIN}delwhite ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} 1-m.cpp -o ${BIN}1-m ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} guidiff.cpp -o ${BIN}guidiff ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} crossnum.cpp -o ${BIN}crossnum ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} nao2giza.cpp -o ${BIN}nao2giza ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} recov-re.cpp -o ${BIN}recov-re ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} recov-re-tgt.cpp -o ${BIN}recov-re-tgt ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} recov-ins.cpp -o ${BIN}recov-ins ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} giza2dbdata.cpp -o ${BIN}giza2dbdata ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} giza2plain.cpp -o ${BIN}giza2plain ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} snt-compare.cpp -o ${BIN}snt-compare ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} corpus-stat.cpp -o ${BIN}corpus-stat ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} rule-eval.cpp -o ${BIN}rule-eval ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} rule-compare.cpp -o ${BIN}rule-compare ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} tree-inspector.cpp -o ${BIN}tree-inspector ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} cmp_line.cpp -o ${BIN}cmp_line ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	${CC} ${CFLAGS} wa-inspector.cpp -o ${BIN}wa-inspector ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	#${CC} ${CFLAGS} hand-rule.cpp -o ${BIN}hrule ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../
	#${CC} ${CFLAGS} ins.cpp -o ${BIN}ins ${OBJ} ${ULIB_OBJ} ${ULIB_INC} -I../

.cpp.o:
	${CC} ${CFLAGS} -c $< -o $*.o ${ULIB_INC}

clean:
	rm -rf *.o
	rm -rf ${BIN}copycat ${BIN}tree_conv ${BIN}cmp_line ${BIN}recov-re ${BIN}wa-inspector ${BIN}copycat-train

co:
	svn co $$svn_ulib
	cd ulib; make; make install; cd ..

